package com.hps.spring.cloud.initializrstart.controller;

import com.hps.spring.cloud.initializrstart.service.CityDataService;
import com.hps.spring.cloud.initializrstart.vo.City;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: hps
 * @Description:
 * @Date: Created in 17:23 2018/9/8
 */
@RestController
@RequestMapping("/cities")
public class CityController {

    private final CityDataService cityDataService;

    public CityController(CityDataService cityDataService) {
        this.cityDataService = cityDataService;
    }

    @GetMapping
    public List<City> listCity() throws Exception {
        return cityDataService.listCity();
    }
}
